<HTML>
<BODY>

<H1><A NAME="EXAMPLES">5 - EPM Packaging Examples</A></H1>

<P>This chapter shows how the EPM and CUPS software is packaged using
EPM list files. The EPM list file example highlights the basic features
of EPM, while the CUPS list file example shows the more advanced features
of EPM.</P>

<H2>Packaging the EPM Software</H2>

<P>The EPM software comes with its own autoconf-generated
<VAR>epm.list</VAR> file that is used to package and test EPM.
The EPM package consists of the main package plus a
"documentation" subpackage for the documentation files and a
"man" subpackage for the man pages.</P>

<P>We start by defining variables for each of the autoconf directory
variables:</P>

<PRE>
$prefix=/usr
$exec_prefix=/usr
$bindir=${exec_prefix}/bin
$datadir=/usr/share
$docdir=${datadir}/doc/epm
$libdir=/usr/lib
$mandir=/usr/share/man
$srcdir=.
</PRE>

<P>Then we provide the general product information that is
required for all packages; notice the use of
<CODE>${srcdir}</CODE> to reference the COPYING and README
files:</P>

<PRE>
%product ESP Package Manager
%copyright 1999-2020 by Michael R Sweet, All Rights Reserved.
%vendor Michael R Sweet
%license ${srcdir}/COPYING
%readme ${srcdir}/README.md
%description Universal software packaging tool for UNIX.
%version 4.5 450
</PRE>

<P>After the product information, we include all of the non-GUI
files that are part of EPM:</P>

<PRE>
# Executables
%system all
f 0555 root sys ${bindir}/epm epm
f 0555 root sys ${bindir}/epminstall epminstall
f 0555 root sys ${bindir}/mkepmlist mkepmlist

# Documentation
%subpackage documentation
%description Documentation for EPM
f 0444 root sys ${docdir}/README $srcdir/README.md
f 0444 root sys ${docdir}/COPYING $srcdir/COPYING
f 0444 root sys ${docdir}/epm-book.epub $srcdir/doc/epm-book.epub
f 0444 root sys ${docdir}/epm-book.html $srcdir/doc/epm-book.html
f 0444 root sys ${docdir}/epm-book.pdf $srcdir/doc/epm-book.pdf

# Man pages
%subpackage man
%description Man pages for EPM
f 0444 root sys ${mandir}/man1/epm.1 $srcdir/doc/epm.man
f 0444 root sys ${mandir}/man1/epminstall.1 $srcdir/doc/epminstall.1
f 0444 root sys ${mandir}/man1/mkepmlist.1 $srcdir/doc/mkepmlist.1
f 0444 root sys ${mandir}/man5/epm.list.5 $srcdir/doc/epm.list.5
</PRE>

<P>Finally, we conditionally include the GUI files depending on
the state of a variable called <CODE>GUIS</CODE>:</P>

<PRE>
# GUI files...
$GUIS=setup uninst

%if GUIS
%subpackage
f 0555 root sys ${libdir}/epm/setup setup
f 0555 root sys ${libdir}/epm/uninst uninst

%system macos
f 0444 root sys ${datadir}/epm/default.icns default.icns
%system all

%subpackage man
f 0444 root sys ${mandir}/man1/setup.1 $srcdir/doc/setup.1
f 0444 root sys ${mandir}/man5/setup.types.5 $srcdir/doc/setup.types.5

%endif
</PRE>


</BODY>
</HTML>
